package com.wutianyi.controller.innvo;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.wutianyi.module.company.Company;
import com.wutianyi.module.member.dataobject.MemberDO;
import com.wutianyi.module.services.CompanyServices;

@Controller("InnovIndexController")
@RequestMapping(value = "/innov/index.do")
public class IndexController {

	@Autowired
	private CompanyServices companyServices;

	private String viewName = "innov/index";

	@RequestMapping
	public ModelAndView execute() {

		ModelAndView modelAndView = new ModelAndView(getViewName());

		MemberDO member = (MemberDO) SecurityUtils.getSubject().getPrincipal();
		
		Company company = companyServices.getCompanyByCId(member.getCompanyId());

		modelAndView.addObject("company", company);
		
		return modelAndView;
	}

	public void setCompanyServices(CompanyServices companyServices) {
		this.companyServices = companyServices;
	}

	public String getViewName() {
		return viewName;
	}

	public void setViewName(String viewName) {
		this.viewName = viewName;
	}

}
